package com.zjhd.sealcutting.utils;

import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.Locale;

/**
 * @author: 王超
 * @Description:
 * @time: 2020/7/27 16:42
 */
public class DateUtil {

    //获取系统当前年份
    public static String getSysYear() {
        Calendar date = Calendar.getInstance();
        String year = String.valueOf(date.get(Calendar.YEAR));
        return year;
    }

    //获取系统当前时间
    public static String strFormatDate(){
        SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");//设置日期格式
        String date=df.format(new Date());
        return date;
    }

    /**
     * TODO  获取系统当前时间  yyyy-MM-dd HH:mm:ss
     * @author wang chao
     * @date 2020/11/25 10:39
     * @param
     * @return
     */
    public static String getCurrentTime(){
        SimpleDateFormat data = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        Calendar calendar = Calendar.getInstance(Locale.CHINA);
        Date time = calendar.getTime();
        return data.format(time);
    }
}
